#!/bin/sh
#
#   http://code.google.com/media-translate/
#   Copyright (C) 2010  Serge A. Timchenko
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program. If not, see <http://www.gnu.org/licenses/>.
#

#
# Translate CGI module
# 'opml.radiotime.com' plug-in
#
# version: 1.0 05.11.2010 5:49
#
# http://opml.radiotime.com/Tune.ashx?id=s29667&sid=p30125
#

stream_type=''
stream_url=''
server_type=''

if echo "${arg_url}" | grep -q -s 'opml\.radiotime\.com/Tune.ashx?.*$'; then 

  local host_response=`$MSDL -q -o ${TMPFILE} -p http --useragent "${USERAGENT}" "${arg_url}" 2>&1`
  
  if [ -f ${TMPFILE} ]; then
    arg_url=`sed -n "1p" "$TMPFILE"`
    rm -f "$TMPFILE"
    check_av_stream
    return $RC_OK
  fi
fi

return $RC_FAIL
